import { IPSWFInteractiveProcess } from './ipswfinteractive-process';
import { IPSWFProcessRole } from './ipswfprocess-role';
import { PSWFProcessImpl } from './pswfprocess-impl';

export class PSWFInteractiveProcessImpl extends PSWFProcessImpl implements IPSWFInteractiveProcess {
  protected editfields: string[] | null = null;

  getEditFields(): string[] | null {
    if (this.editfields == null) {
      const value = this.M.editFields;
      if (value == null) {
        return null;
      }
      const arrayNode: any[] = value;
      if (arrayNode.length == 0) {
        return null;
      }
      const list: string[] = [];
      for (let i = 0; i < arrayNode.length; i++) {
        list.push(arrayNode[i]);
      }
      this.editfields = list;
    }
    return this.editfields.length == 0 ? null : this.editfields;
  }

  get editFields(): string[] | null {
    return this.getEditFields();
  }

  get editMode(): 0 | 1 | 2 {
    return this.M.editMode != null ? this.M.editMode : 0;
  }

  get formCodeName(): string {
    return this.M.formCodeName;
  }

  get memoField(): string {
    return this.M.memoField;
  }

  get mobFormCodeName(): string {
    return this.M.mobFormCodeName;
  }

  get mobUAGroupCodeName(): string {
    return this.M.mobUAGroupCodeName;
  }

  get mobUtil2FormCodeName(): string {
    return this.M.mobUtil2FormCodeName;
  }

  get mobUtil2FormName(): string {
    return this.M.mobUtil2FormName;
  }

  get mobUtil3FormCodeName(): string {
    return this.M.mobUtil3FormCodeName;
  }

  get mobUtil3FormName(): string {
    return this.M.mobUtil3FormName;
  }

  get mobUtil4FormCodeName(): string {
    return this.M.mobUtil4FormCodeName;
  }

  get mobUtil4FormName(): string {
    return this.M.mobUtil4FormName;
  }

  get mobUtil5FormCodeName(): string {
    return this.M.mobUtil5FormCodeName;
  }

  get mobUtil5FormName(): string {
    return this.M.mobUtil5FormName;
  }

  get mobUtilFormCodeName(): string {
    return this.M.mobUtilFormCodeName;
  }

  get mobUtilFormName(): string {
    return this.M.mobUtilFormName;
  }

  get msgType(): 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128 | 256 | 512 {
    return this.M.msgType;
  }

  get multiInstMode(): 'NONE' | 'PARALLEL' | 'SEQUENTIAL' {
    return this.M.multiInstMode;
  }

  protected pswfprocessroles: IPSWFProcessRole[] | null = null;

  getPSWFProcessRoles(): IPSWFProcessRole[] | null {
    if (this.pswfprocessroles == null) {
      this.pswfprocessroles = this.fillChildListModel(this.M.getPSWFProcessRoles, 'wf.IPSWFProcessRole') as IPSWFProcessRole[];
    }
    return this.pswfprocessroles;
  }

  get psWFProcessRoles(): IPSWFProcessRole[] | null {
    return this.getPSWFProcessRoles();
  }

  findPSWFProcessRole(objKey: any): IPSWFProcessRole | null {
    return this.getPSModel5('wf.IPSWFProcessRole', this.getPSWFProcessRoles(), objKey) as IPSWFProcessRole;
  }

  protected predefinedactions: string[] | null = null;

  getPredefinedActions(): string[] | null {
    if (this.predefinedactions == null) {
      const value = this.M.predefinedActions;
      if (value == null) {
        return null;
      }
      const arrayNode: any[] = value;
      if (arrayNode.length == 0) {
        return null;
      }
      const list: string[] = [];
      for (let i = 0; i < arrayNode.length; i++) {
        list.push(arrayNode[i]);
      }
      this.predefinedactions = list;
    }
    return this.predefinedactions.length == 0 ? null : this.predefinedactions;
  }

  get predefinedActions(): string[] | null {
    return this.getPredefinedActions();
  }

  get uAGroupCodeName(): string {
    return this.M.uAGroupCodeName;
  }

  get util2FormCodeName(): string {
    return this.M.util2FormCodeName;
  }

  get util2FormName(): string {
    return this.M.util2FormName;
  }

  get util3FormCodeName(): string {
    return this.M.util3FormCodeName;
  }

  get util3FormName(): string {
    return this.M.util3FormName;
  }

  get util4FormCodeName(): string {
    return this.M.util4FormCodeName;
  }

  get util4FormName(): string {
    return this.M.util4FormName;
  }

  get util5FormCodeName(): string {
    return this.M.util5FormCodeName;
  }

  get util5FormName(): string {
    return this.M.util5FormName;
  }

  get utilFormCodeName(): string {
    return this.M.utilFormCodeName;
  }

  get utilFormName(): string {
    return this.M.utilFormName;
  }

  get editable(): boolean {
    return this.M.editable != null ? this.M.editable : false;
  }

  get sendInform(): boolean {
    return this.M.sendInform;
  }

  get cls(): string {
    return 'PSWFInteractiveProcessImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'wf.IPSWFInteractiveProcess') return true;
    return super.instanceof(cls);
  }
}
